﻿using System;
using System.Net.NetworkInformation;

namespace DataModel.Commands
{
    public class HasNetworkConnection : staticCondition
    {
        static HasNetworkConnection()
        {
            NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
        }

        static void NetworkChange_NetworkAddressChanged(object sender, EventArgs e)
        {
            OnConditionChanged();
        }

        public override bool value(object parameter)
        {
            return NetworkInterface.GetIsNetworkAvailable();
        }
    }
}
